package com.evolution.warlock.excle;

import java.lang.reflect.Field;

public class AttributiesBean {
	private String className;
	private String attr;
	private Class cls;
	private Field field;
	public AttributiesBean(Class class1, String attr)  {
		super();
		this.cls=class1;
		this.className = class1.getSimpleName();
		this.attr = attr;
		try {
			field = class1.getDeclaredField(attr);
		} catch (Exception e) {
			throw new IllegalArgumentException(class1+"中没有查找到Excle输出配置中的Field="+attr+"。");
		}
		field.setAccessible(true);
		
	}

	public String getClassName() {
		return className;
	}

	public String getAttr() {
		return attr;
	}
	
	public Object get(Object obj) throws IllegalArgumentException, IllegalAccessException{
		return field.get(obj);
	}
}
